#include <config.h>
#ifdef LANG_X86

[GLOBAL atomicExchange]
atomicExchange:
  mov  ecx, [esp+4]    ; Get lock address
  mov  eax, [esp+8]    ; Get new value.
  xchg eax, [ecx]      ; Old value atomically goes in eax.
  ret

#endif // LANG_X86
